<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文章添加</title>
    <meta name="keywords" content="后台产品添加">
    <meta name="description" content="后台产品添加">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__ADMIN__css/bootstrap.min.css" rel="stylesheet">
    <link href="__ADMIN__css/font-awesome.min.css" rel="stylesheet">
    <link href="__ADMIN__css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__ADMIN__css/animate.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/layer/skin/default/layer.css" rel="stylesheet">
    <link href="__ADMIN__css/style.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/webuploader/webuploader.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/webuploader/style.css" rel="stylesheet"> 
    <script type="text/javascript" src="__ADMIN__uedit/ueditor.config.js"></script>
    <script type="text/javascript" src="__ADMIN__uedit/ueditor.all.js"></script>

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加文章</h5>
                </div>
                <div class="ibox-content">
                    <form method="post" id="formadd" name="formadd" class="form-horizontal" action="{:U('Article/save')}" enctype="multipart/form-data">
                        <div class="form-group">
                            <input type="hidden" name="id" value="{$result.id}">
                            <label class="col-sm-2 control-label">文章标题：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="title" name="title" value="{$result.title}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">所属栏目：</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="cat_id" id="cat_id">
                                    <option value="">====请选择分组====</option>
                                    <volist name="opt" id="vo">
                                        <option value="{$vo.id}" <if condition="$result['cat_id'] eq $vo['id']">selected</if>>{$vo.html}{$vo.coltitle}</option>         
                                    </volist> 
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">文章图片：</label>
                            <div class="col-sm-10">
                                <div id="containerbox">
                                    <input type="hidden" name="litpic" id="litpic" value="{$result.img}">
                                    <div id="uploader">
                                        <div class="queueList">
                                            <div id="dndArea" class="placeholder">
                                                <div id="filePicker"></div>
                                                <p>或将照片拖到这里，单次最多可选300张</p>
                                            </div>
                                        </div>
                                        <div class="statusBar" style="display:none;">
                                            <div class="progress">
                                                <span class="text">0%</span>
                                                <span class="percentage"></span>
                                            </div>
                                            <div class="info"></div>
                                            <div class="btns">
                                                <div id="filePicker2"></div>
                                                <div class="uploadBtn">开始上传</div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">文章关键词：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="tag" name="tag" value="{$result.tag}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">文章作者：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="author" name="author" value="{$result.author}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">产品内容：</label>
                            <div class="col-sm-10">
                                <script id="container" name="content" type="text/plain">{$result.content|htmlspecialchars_decode|strip_tags}</script>  
                                <script type="text/javascript">
                                    var ue = UE.getEditor('container');
                                </script>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">文章seo标题：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="seo_title" name="seo_title" value="{$result.seo_title}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">文章关键词：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="seo_keywords" name="seo_keywords" value="{$result.seo_keywords}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">文章描述：</label>
                            <div class="col-sm-10">
                            <textarea name="seo_description" id="seo_description" rows="8" cols="160">{$result.seo_description}</textarea>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否生成静态页面：</label>
                            <div class="col-sm-10">
                                <input type="radio" name="is_html" id="is_html" value="1" <if condition="$resultedit['is_html'] eq 1">checked</if>>静态
                                <input type="radio" name="is_html" id="is_html" value="2" <if condition="$resultedit['is_html'] eq 2">checked</if>>动态
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">点击次数：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="hits" name="hits" value="{$result.hits}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">排序：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="sort" name="sort" value="{$result.sort}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存内容</button>
                                <a class="btn btn-white" href="javascript:history.go(-1)">取消</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__ADMIN__js/jquery.min.js"></script>
<script src="__ADMIN__js/bootstrap.min.js"></script>
<script src="__ADMIN__js/plugins/validate/jquery.validate.min.js"></script>
<script src="__ADMIN__js/plugins/validate/messages_zh.min.js"></script>
<script src="__ADMIN__js/plugins/layer/layer.js"></script>
<script src="__ADMIN__js/comment.js"></script>
<script src="__ADMIN__js/plugins/webuploader/webuploader.js"></script>
<script src="__ADMIN__js/plugins/webuploader/upload.js"></script>
<script>
    $(function(){
        $('#formadd').validate({ 
            rules:{
                title:"required", 
                signum:"required",
                keywords:"required",
                description:"required"
            },
            messages:{
                title:'组名不能为空!',
                signum:'请输入产品编号！',
                keywords:'请填写关键词！',
                description:'请填写描述！'
            },
            //提交成功后执行
            submitHandler:function(form){
                var forma = new FormData (document.getElementById('formadd'));
                $.ajax({
                    url:$(form).attr('action'),//地址是通过form 的action
                    type:'post',
                    dataType:'json',
                    data:forma,//传的对象
                    cache:false,
                    processData:false,
                    contentType:false, 
                    success:function(data){
                        if(data.status < 1){
                            comment.error(data.mess);
                        }else{
                            comment.success(data.mess,"{:U('Article/index')}");
                        }
                    }
                });

            }
        });
    });
</script>
</body>
</html>